<template>
  <a-flex gap="middle" justify="flex-end">
    <a-space>
      <a-button
        v-for="(item, index) in config"
        :key="index"
        :type="item.type"
        :shape="item.shape"
        @click="Click(item.emitCode)"
      >
        <icon :type="item.icon" />
        {{ item.label }}
      </a-button>
    </a-space>
  </a-flex>
</template>

<script setup>
import icon from "@/utils/icon";

const { config } = defineProps({
  config: {
    type: Array,
    required: true,
  },
});

const emit = defineEmits(["type"]);

const Click = (emitCode) => {
  emit("type", emitCode);
};
</script>

<style scoped lang="scss">
.ant-space {
  margin-bottom: 16px;
}
</style>
